<?php

class Application_Form_AddProduct extends Zend_Form {

    public function init(){
            // Set the method for the display form to POST
        $this->setMethod('post');
 
        // Name element
        $this->addElement('text', 'name', array(
            'label'      => 'Nume:',
            'required'   => true,
            'filters'    => array('StringTrim'),
            'validators' => array(
            	array('StringLength', false, array(0, 50)),
            )
        ));
        
        $this->addElement(new Application_Form_Element_CategorySelect('id_category'));

        // nbr_pieces element
        $this->addElement('text', 'nbr_pieces', array(
        		'label' => 'In stoc:',
        		'filters'    => array('StringTrim'),
        		'required' => true,
        		'validators' => array(
        				array('StringLength', false, array(0, 10)),
        		)
        ));
        
        // price element
        $this->addElement('text', 'price', array(
            'label' => 'Pret:',
        	'filters'    => array('StringTrim'),
            'required' => true,
        	'validators' => array(
        			array('StringLength', false, array(0, 10)),
        	)
        ));
        

        // picture_location element
        $this->addElement('text', 'picture_location', array(
        		'label' => 'Poza:',
        		'filters'    => array('StringTrim'),
        		'required' => true,

        ));

        //TODO make this a file selector --> acces the file gallery
//         $this->addElement('file', 'image_file', array(
//         		'label' => 'Test:',
//         		'required' => true,
//         		'validators' => array(
//         				array('Extension', false,  
//         						array('png', 'jpg', 'jpeg', 'case' => true)),
//         				array('ImageSize', false, array('min' => '10kB',
//                             'max' => '4MB',
//                             'bytestring' => false)))
//         ));
  
        // Add the submit button
        $this->addElement('submit', 'submit', array(
            'ignore'   => true,
            'label'    => 'Adauga Produs',
        ));
    }
}

